package com.feng.springbootpropertiesdemo1;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 */
@RestController
@SpringBootApplication
public class SpringBootPropertiesDemo1Application {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootPropertiesDemo1Application.class, args);
    }

    @Value("${book.name}")
    private String bookName;
    @Value("${book.price}")
    private double bookPrice;


    @RequestMapping("/")
    public String index(){
        System.out.println("价格： "+bookPrice);
        return bookName;
    }

}
